import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.SocketException;

public class UDPServer {
    public static void main(String[] args) {
        DatagramSocket datagramSocket = null;
        try {
            datagramSocket = new DatagramSocket(8888);

            byte[] bytes = new byte[1024];
            DatagramPacket datagramPacket = new DatagramPacket(bytes, bytes.length);
            datagramSocket.receive(datagramPacket);

            String info = new String(datagramPacket.getData(), 0, datagramPacket.getLength());

            System.out.println(info);

            datagramSocket.close();
        } catch (SocketException ignored) {


        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
